﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Testing
{
    public partial class FormImageDisplay : Form
    {
        readonly Image piccy;
        private readonly Point[] piccyBounds;

        public FormImageDisplay()
        {
            InitializeComponent();
            piccy = Image.FromFile(@"Target\Target4.jpg");
            AutoScrollMinSize = piccy.Size;
            piccyBounds = new Point[3];
            piccyBounds[0] = new Point(0, 0);
            piccyBounds[1] = new Point(piccy.Width, 0);
            piccyBounds[2] = new Point(0, piccy.Height);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics dc = e.Graphics;
            dc.ScaleTransform(1.0f, 1.0f);
            dc.TranslateTransform(AutoScrollPosition.X, AutoScrollPosition.Y);
            dc.DrawImage(piccy, piccyBounds);
        }

        protected override void Dispose(bool disposing)
        {
            piccy.Dispose();
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
